package main

import (
	"github.com/gogap/logs"
	"yundian/internel/app/dao"
	"yundian/internel/pkg/dbs"
	"yundian/internel/pkg/dingo"
	"yundian/internel/pkg/dingo/global"
)

func main() {
	//dingo.InitViper("./configs/adm.yaml")
	//dingo.InitViper("./configs/zmtest-adm.yaml")
	dingo.InitViper("./configs/zhongman.yaml")
	dbs.NewMysqlComponent().Step()

	// KA
	//userIdArr := dao.NewUserDao().QueryChildUserIds(403735).Unwrap().([]int)
	//if db := global.Orm.Exec("UPDATE users SET is_admin=6 WHERE is_admin<>3 AND id IN(?)", userIdArr); db.Error != nil {
	//	logs.Error(db.Error)
	//}

	// 大区
	userIdArr := dao.NewUserDao().QueryChildUserIds(403740).Unwrap().([]int)
	if db := global.Orm.Exec("UPDATE users SET is_admin=7 WHERE is_admin<>3 AND id IN(?)", userIdArr); db.Error != nil {
		logs.Error(db.Error)
	}
}
